package com.rd.student.jike.class2.lihongming.week724_730.Day728.DecoratorMode;

/**
 * @Auther:Heinrich
 * @Date:2023/7/28-07-28-14:38
 * @Description:c230728.DecoratorMode
 * @version:1.0
 */
//调料类
public class Decorator extends Drink{
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public double cost() {
        return super.getPrice()+drink.getPrice();
    }
    @Override
    public String getDesc() {
        return drink.getDesc()+" "+super.getDesc();
    }
}

class milk extends Decorator{

    public milk(Drink drink) {
        super(drink);
        super.setPrice(1.9);
        super.setDesc("加牛奶");
    }

}
class Sugar extends  Decorator {
    public Sugar(Drink drink) {
        super(drink);
        super.setPrice(0.5);
        super.setDesc("加糖");
    }
}